sky.use(['dom','ajax'],function($,ajax){

	//查询
	var xSearch = ajax.create('/info?realtime=1','GET').extra({
		oncallback:function(){
			$('time').innerHTML = new Date(this.getResponseHeader('Date')).format('YYYY年MM月DD日 hh时mm分ss秒');
			var v = this.responseJSON || {};
			var network = v.networks || {};
			$('li_rx').innerHTML = network.rx || 0;
			$('li_tx').innerHTML = network.tx || 0;
			var user = v.user || {};
			$('li_num').innerHTML = user.num || 0;
			$('li_mem').innerHTML = v.mem || 0;
			$('li_turn').innerHTML = v.turn || 0;
			var sys = v.sys || {};
			$('li_cup').innerHTML = sys.cpu || 0;
			$('li_load').innerHTML = sys.load || 0;
		},
		get:function(){
			this.send({
				vendor:$('vendor').value,
				type:$('type').value
			},true);
		}
	});

	$.vclick('search_btn',function(){
		xSearch.get();
	});

	//获取所有厂商
	ajax.get('/info?getvendor=1',function(){
		var vendor = $('vendor');
		sky.forEach(this.responseJSON.data || [],function(v){
			var opt = new Option(v,v);
			vendor.appendChild(opt);
		});
		xSearch.get();
	});
});
